import provinces from 'china-division/dist/provinces.json';
import cities from 'china-division/dist/cities.json';
provinces.forEach(province => {
    province.name === '台湾省' ? province.name = '中国台湾' : '';
    province.name === '香港特别行政区' ? province.name = '中国香港特别行政区' : '';
    province.name === '澳门特别行政区' ? province.name = '中国澳门特别行政区' : '';
});
cities.forEach((city) => {
    const matchProvince = provinces.filter(province => province.code === city.parent_code)[0];
    if (matchProvince) {
        matchProvince.children = matchProvince.children || [];
        matchProvince.children.push({
            label: city.name,
            value: city.name,
            children: city.children,
        });
    }
});

const options = provinces.map(province => ({
    label: province.name,
    value: province.name,
    children: province.children,
}));

export default options;